#!/usr/bin/bash
#
# $Id: $
#

ANTLR3HOME="..\antlr-3.2\antlr-3.2.jar"

echo "Removing old files..."


find $p -type f -iname build.txt              -exec rm -v {} \;
find $p -type f -iname CPP_grammar_.tokens    -exec rm -v {} \;
find $p -type f -iname 'CPP_grammar_Lexer.*'  -exec rm -v {} \;
find $p -type f -iname 'CPP_grammar_Parser.*' -exec rm -v {} \;


echo "Generating code..."
java -jar "$ANTLR3HOME"  CPP_grammar_.g > build.txt 2>&1
echo "Generation done. Output redirected to build.txt"
mv CPP_grammar_Lexer.c CPP_grammar_Lexer.cpp
mv CPP_grammar_Parser.c CPP_grammar_Parser.cpp
echo "Files generated are:"
ls -l CPP_grammar_*.*

exit